// The module 'vscode' contains the VS Code extensibility API
// Import the module and reference it with the alias vscode in your code below
import * as vscode from 'vscode';

// this method is called when your extension is activated
// your extension is activated the very first time the command is executed
export function activate(context: vscode.ExtensionContext) {

	// Use the console to output diagnostic information (console.log) and errors (console.error)
	// This line of code will only be executed once when your extension is activated
	console.log('恭喜，插件“chanyuantiandao”已经被成功激活！');

	// The command has been defined in the package.json file
	// Now provide the implementation of the command with registerCommand
	// The commandId parameter must match the command field in package.json
	let init = vscode.commands.registerCommand('chanyuantiandao.helloWorld', () => {
		// The code you place here will be executed every time your command is executed
		// Display a message box to the user
		vscode.window.showInformationMessage('这是一条来自插件“chanyuantiandao”的消息！');
	});

	let filePath = vscode.commands.registerCommand('chanyuantiandao.getCurrentFilePath', (uri) => {
		vscode.window.showInformationMessage(`当前文件（夹）路径：${uri ? uri.path : '空'}`);
	});

	// 编辑器命令
	context.subscriptions.push(vscode.commands.registerTextEditorCommand('chanyuantiandao.testEditorCommand', (textEditor, edit) => {
		console.log('您正在执行编辑器命令！');
		console.log(textEditor, edit);
	}));

	// 是否必须？与package.json中的commands配置项关系
	//context.subscriptions.push(init);
	//context.subscriptions.push(filePath);
}

// this method is called when your extension is deactivated
export function deactivate() { }